package cn.kgc.springcloud.client;

import cn.kgc.springcloud.entity.ResponseResult;
import cn.kgc.springcloud.entity.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @author 课工场
 * @date 2024/7/22
 * @description
 *   引入openfeign依赖之后  默认集成了ribbon负载均衡组件
 *   @FeignClient("OPENFEIGNPRODUCER")      http://localhost:8520
 *   @GetMapping("/producer/m1")    /producer/m1
 */
@FeignClient("OPENFEIGNPRODUCER")
public interface ProducerClient {

    @GetMapping("/producer/m1")
    String method1();

    /*
    *  /producer/m2 ?id=10  queryString  @RequestParam("id")
    * */
    @GetMapping("/producer/m2")
    String method2(@RequestParam("id") Integer id);

    //  /producer/m3/10
    @GetMapping("/producer/m3/{id}")
    String method3(@PathVariable("id") Integer id);


    //  /m4?id =   & username = & password =
    @GetMapping("/producer/m4")
    String method4(@RequestParam("id")Integer id,@RequestParam("username")String username,@RequestParam("password")String password);


    //  @RequestBody  声明参数以json的格式进行传递
    @PostMapping("/producer/m5")
    String method5(@RequestBody User user);


    // ?ids=1&ids=2&ids=3
    @PostMapping("/producer/m6")
    String method6(@RequestParam("ids") Integer[] ids);


    @GetMapping("/producer/m7")
    ResponseResult method7();
}
